import { request } from '@umijs/max';

export async function queryList(
  params: {
    /** keyword */
    keyword?: string;
    /** current */
    current?: number;
    /** pageSize */
    pageSize?: number;
  },
  options?: { [key: string]: any },
) {
  return request<any>('/api/queryTailList', {
    method: 'GET',
    params: {
      ...params,
    },
    ...(options || {}),
  });
}

export async function addData(
  body?: API.TailOrder,
  options?: { [key: string]: any },
) {
  return request<API.Result_UserInfo_>('/api/addTailOrder', {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

export async function modifyData(
  params: {
    // path
    id?: number | string;
  },
  body?: API.TailOrder,
  options?: { [key: string]: any },
) {
  const { id: param0 } = params;
  return request<any>(`/api/modifyTailOrder/${param0}`, {
    method: 'PUT',
    headers: {
      'Content-Type': 'application/json',
    },
    data: body,
    ...(options || {}),
  });
}

export async function deleteData(
  params: {
    // path
    /** userId */
    id?: number | string;
  },
  options?: { [key: string]: any },
) {
  const { id: param0 } = params;
  return request<API.Result_string_>(`/api/deleteTailOrder/${param0}`, {
    method: 'DELETE',
    params: { ...params },
    ...(options || {}),
  });
}
